package org.gongliang.jsmile.excel;


import org.gongliang.jsmile.excel.filter.ExcelCellType;
import org.gongliang.jsmile.excel.filter.ExcelFilter;
import org.gongliang.jsmile.excel.filter.ExcelVersion;
import org.gongliang.jsmile.excel.style.DeafultExcelStyle;
import org.gongliang.jsmile.excel.style.ExcelStyle;

@SuppressWarnings("rawtypes")
public class ExportParams {

	public ExportParams(String sheetName) {
		excelStyle = new DeafultExcelStyle();
		this.sheetName = sheetName;
	}

	public static ExportParams init(String sheetName) {
		return new ExportParams(sheetName);
	}

	/**
	 * 默认版本号为2003
	 */
	ExcelVersion excelVersion = ExcelVersion.EXCEL_2003;

	/**
	 * sheet名称
	 */
	private String sheetName;
	/**
	 * 有几行文件头
	 */
	private int headerRow = 1;
	/**
	 * 中文header
	 */
	private String[] header;
	/**
	 * 对象属性
	 */
	private String[] columns;

	private ExcelCellType[] cellTypes;

	/**
	 * excel过滤器
	 */
	private ExcelFilter excelFilter;
	/**
	 * 设置excel样式
	 */
	private ExcelStyle excelStyle;

	public ExportParams excelVersion(ExcelVersion excelVersion) {
		this.excelVersion = excelVersion;
		return this;
	}

	public ExportParams sheetName(String sheetName) {
		this.sheetName = sheetName;
		return this;
	}

	public ExportParams headerRow(int headerRow) {
		if (headerRow < 1) {
			headerRow = 1;
		}
		this.headerRow = headerRow;
		return this;
	}

	public ExportParams header(String... header) {
		this.header = header;
		return this;
	}

	public ExportParams columns(String... columns) {
		this.columns = columns;
		return this;
	}

	public ExportParams excelFilter(ExcelFilter excelFilter) {
		this.excelFilter = excelFilter;
		return this;
	}

	public ExportParams excelStyle(ExcelStyle excelStyle) {
		if (excelStyle != null) {
			this.excelStyle = excelStyle;
		}
		return this;
	}

	public ExportParams cellTypes(ExcelCellType[] cellTypes) {
		if (cellTypes != null && cellTypes.length > 0) {
			this.cellTypes = cellTypes;
		}
		return this;
	}

	public ExcelVersion getExcelVersion() {
		return excelVersion;
	}

	public void setExcelVersion(ExcelVersion excelVersion) {
		this.excelVersion = excelVersion;
	}

	public String getSheetName() {
		return sheetName;
	}

	public void setSheetName(String sheetName) {
		this.sheetName = sheetName;
	}

	public int getHeaderRow() {
		return headerRow;
	}

	public void setHeaderRow(int headerRow) {
		this.headerRow = headerRow;
	}

	public String[] getHeader() {
		return header;
	}

	public void setHeader(String[] header) {
		this.header = header;
	}

	public String[] getColumns() {
		return columns;
	}

	public void setColumns(String[] columns) {
		this.columns = columns;
	}

	public ExcelCellType[] getCellTypes() {
		return cellTypes;
	}

	public void setCellTypes(ExcelCellType[] cellTypes) {
		this.cellTypes = cellTypes;
	}

	public ExcelFilter getExcelFilter() {
		return excelFilter;
	}

	public void setExcelFilter(ExcelFilter excelFilter) {
		this.excelFilter = excelFilter;
	}

	public ExcelStyle getExcelStyle() {
		return excelStyle;
	}

	public void setExcelStyle(ExcelStyle excelStyle) {
		this.excelStyle = excelStyle;
	}

}
